var $j = jQuery.noConflict();

function CheckAll(value) 
{
   var boxes=document.getElementsByTagName("input");
   for(var i=0; i<boxes.length; i++) {
      if (boxes[i].type=='checkbox') {
          boxes[i].checked=value;
      }
   }
}

function fill_tags_input(v)
{
  document.getElementById("newpost_tags").value += v + " ";
  document.getElementById("newpost_tags").focus();
}

function clearMenus(){
	$j('.catdropm').hide();
}
function handleHover(){
	$j("body").bind("click",function(event){
		if(!$j(event.target).is('.catdrop')&&(!$j(event.target).attr("id")||$j(event.target).attr("id").substring(0,10)!='tooltoggle')){
			clearMenus();
		}});
	$j('.catdrop').click(function(){
		var m=$j(this).parents('li.h-drop').children('.catdropm');
		m.toggle();
		$j('.catdropm:visible').not(m).hide();
		return false;
	});
}

function toggleLogin(){
	if($j('#login-form').css('display')=='none'){
		$j('.side-header').css('display','none');
		$j('#login-form').fadeIn(function(){
			$j('#side-username').focus();
		});
	}else{
		$j('#login-form').fadeOut(function(){
			$j('.side-header').css('display','block');
		});
	}
	return false;
}

var getObj = function(objId) {
	return document.all ? document.all[objId] : document.getElementById(objId);
}

var checkIngType = function(doing, status) {
	obj1 = getObj(doing);
	remain = 140 - obj1.value.length;
	obj2 = getObj(status);
	obj2.innerHTML = "内容(剩余" + remain + "字)";
}